import java.io.*;
import java.util.Arrays;
import java.util.Random;

public class Main {
    static int nnnnnn = 6;
    static String fileName = "1";
    static String inFile = fileName + ".in";
    static String outFile = fileName + ".out";
    static Random rand = new Random();
    static File in = new File(inFile);
    static File out = new File(outFile);
    static void solution() throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(in)));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out)));
        //可修改部分//此部分为从文件中读取
        long n = Long.valueOf(br.readLine());
        String[] scan = br.readLine().split(",");
        long[] piles = new long[scan.length];
        for (int i = 0; i < piles.length; i++) {
            piles[i] = Long.valueOf(scan[i]);
        }
        //一下为正解部分
        Arrays.sort(piles);
        int res = 0;
        for(int i = piles.length / 3; i < piles.length; i += 2) res += piles[i];
        //将正解写入out文件
        bw.write(String.valueOf(res));
        bw.flush();
        //
        bw.close();
    }
    //输入测试点函数
    static void writeTest() throws IOException {
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(in)));
        //可修改部分如下
        long min = 3;//确定最小值
        long max = 100000 / 3;//确定最大值
        long n = 3 * (long)(rand.nextDouble() * (max - min));
        System.out.println((n < 100000) && (n % 3 == 0));
        bw.write(String.valueOf(n) + "\n");
        bw.flush();
        for(int i = 0; i < n; i++){
            long x = ((long)(rand.nextDouble() * (max - min)) / 100) + 1;
            if(i != 0) bw.write(",");
            bw.write(String.valueOf(x));
            bw.flush();
        }
        //可修改部分截止
        bw.close();
    }
    public static void main(String[] args) throws IOException {
        System.out.println("开始输入测试点");
        writeTest();
        System.out.println("输入完成");
        System.out.println("开始计算正解");
        solution();
        System.out.println("正解写入完毕");
    }
}